package com.ttdev.mmms.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

/**
 * 登录的角色判断
 * 2019年12月14日08:46:17
 */
@Controller
public class IfController {

    // 用来判断登陆的角色
    @PostMapping("/role")
    public String role(@RequestParam(value = "role")Integer role){
        //管理员
        if (role == 1) {
            return "forward:/admin/login";
            //商店
        } else if(role == 2) {
            return "forward:/store/login";
            //会员
        } else if(role == 3) {
            return "forward:/memberLogin/login";
        } else {
            return "error/403";
        }
    }
}